#ifndef N1NETWORK_H_2009_09_30
#define N1NETWORK_H_2009_09_30

#include "N0Lib.h"

// Host to network byte order
uint16 N1H2N16(uint16 n);
uint32 N1H2N32(uint32 n);
uint64 N1H2N64(uint64 n);

// Network to host byte order
uint16 N1N2H16(uint16 n);
uint32 N1N2H32(uint32 n);
uint64 N1N2H64(uint64 n);


template<typename T>
T N1ReadInteger(const void* ptr)
{
    T value;
    memcpy(&value, ptr, sizeof(T));
    return value;
}

template<typename T>
void N1WriteInteger(void* ptr, T value)
{
    memcpy(ptr, &value, sizeof(T));
}

#endif //N1NETWORK_H_2009_09_30
